<!DOCTYPE html>
<html lang="en">
<head>
    <title>炫投娱乐管理后台</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="/admin/favicon.ico" />
    <link href="/res/css/share/style.default.css" rel="stylesheet">

</head>

<body id="signin" class="signin">


<section>
  
    <div class="signinpanel">
        
        <div class="row">
            
            <div class="col-md-7">

                <div class="signin-info">
                    <div class="logopanel">
                        <h1><span></span> 炫投娱乐 <span></span></h1>
                    </div><!-- logopanel -->
                
                    <div class="mb20"></div>
                
                    <h5><strong>欢迎</strong></h5>

                </div><!-- signin0-info -->
            
            </div><!-- col-sm-7 -->
            
            <div class="col-md-5">
                
                <form  class="form" id="login" >
                    <h4 class="nomargin">登 录</h4>
                    <p class="mt5 mb20">登录访问您的帐户.</p>
                    <div  id="loginNote" class="alert alert-info" ><strong>Well done!</strong></div>
                    <div class="form-group">
                    <input type="text" name="username" id="username" class="form-control uname" placeholder="用户名"  />
                    </div>
                    <div class="form-group">
                    <input type="password" name="password" id="password" class="form-control pword" placeholder="密码"  />
                    </div>
                    <button id="loginBtn"  type="submit" class="btn btn-success btn-block">登 录</button>
                    
                </form>
            </div><!-- col-sm-5 -->
            
        </div><!-- row -->
        
        <div class="signup-footer">
            <div class="pull-left">
                &copy; 2017.
            </div>

        </div>
        
    </div><!-- signin -->

</section>

<script src="/res/script/share/jquery-1.11.1.min.js"></script>
<script src="/res/script/share/jquery-migrate-1.2.1.min.js"></script>
<script src="/res/script/share/jquery-ui-1.10.3.min.js"></script>
<script src="/res/lib/bost/bootstrap.js"></script>
<script src="/res/script/share/util.js"></script>
<script src="/res/script/share/modernizr.min.js"></script>
<script src="/res/script/share/jquery.cookies.js"></script>
<script src="/res/lib/director.js"></script>
<script src="/res/script/share/validateRegExp.js"></script>
<script src="/res/lib/layer/layer.js"></script>
<link href="/res/lib/validator/css/bootstrapValidator.css" rel="stylesheet">
<script src="/res/lib/validator/js/bootstrapValidator.js"></script>


<script>
    jQuery(document).ready(function(){

        var browserIdentify =function () {
            var browser = {
                versions: function () {
                    var u = navigator.userAgent, app = navigator.appVersion;
                    return {         //移动终端浏览器版本信息
                        trident: u.indexOf('Trident') > -1, //IE内核
                        presto: u.indexOf('Presto') > -1, //opera内核
                        webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                        gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
                        mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                        ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                        android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
                        iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
                        iPad: u.indexOf('iPad') > -1, //是否iPad
                        webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
                    };
                }(),
                language: (navigator.browserLanguage || navigator.language).toLowerCase()
            }

            if (!browser.versions.mobile) {//判断是否是移动设备打开。browser代码在下面

                if(browser.versions.trident){
                    $.rootErrorDialog("您的浏览器不兼容,请安装火狐浏览器",2000,function () {
                        window.location.href="/admin/404.html"
                    });

                }
            }
        }

        browserIdentify()


        var $loginNote= $("#loginNote")

        $('#login').bootstrapValidator({
            fields:{
                username: {
                    validators: {
                        notEmpty: {
                            message: '必须填写用户名'
                        }
                    }
                },
                password: {
                    validators: {
                        notEmpty: {
                            message: '必须填写密码'
                        }
                    }
                },
            }
        })
            .on('success.form.bv', function(e) {
                // Prevent form submission
                e.preventDefault();
                var $username=$("#username"),
                    $password=$("#password");
                var index = layer.load(0);
                // Get the form instance
                $.restPost("/user/doLoginBackend",{
                    userName:$username.val(),
                    passWord:$password.val()
                }).done(function (msg,data) {
                    layer.close(index)
                    console.log(data)
                    window.localStorage.setItem('token', data.token)
                    window.location.href="/admin/#/home.html"

                }).fail(function (mess) {
                    layer.close(index)
                    $.rootErrorDialog(mess,3000)
                });
            });
        /*$("#loginBtn").on("click ",function (e) {

            $('#defaultForm').bootstrapValidator('validate');

        });

        $(window).on("keydown",function (e) {
            if(e.keyCode==13){
                submitLogin()
            }
        });*/

        /*function submitLogin() {
            ve_01.commit({
                sbtSucceed:function(){
                    var $username=$("#username"),
                            $password=$("#password");

                    var doLoginPost = $.restPost("/doLogin",{
                        userName:$username.val(),
                        passWord:$password.val()
                    });

                    var index = layer.load(0);
                    doLoginPost.done(function (msg,data) {
                        layer.close(index)
                        console.log(data)
                        if(data.authority == "0" || data.authority == "99" ){
                            window.location.href="/admin/#/dividend/index.html"
                        }else if(data.authority == "11"){
                            window.location.href="/admin/#/home.html"
                        }else if(data.authority == "12"){
                            window.location.href="/admin/#/finance/bill.html"
                        }else if(data.authority == "13" || data.authority == "14" || data.authority == "15"){
                            window.location.href="/admin/#/member/register.html"
                        }else{
                            alert("超出权限")
                        }

                    }).fail(function (mess) {
                        layer.close(index)
                    });

                    doLoginPost.fail(function (msg,data) {
                        $loginNote.removeClass("alert-danger").addClass("alert-danger").children("strong").text(msg)
                    });

                }
            });
        }*/

    });
</script>

</body>
</html>
